import boom from '@hapi/boom';

function verifyToken(req, res, next) {
    const token = req?.headers?.authorization
    if(token){
        const tokenArr = token.split(' ');
        const bearerToken = tokenArr[1];
        req.token = bearerToken;
        next();
    } else {
        next(boom.forbidden('没有访问权限'))
    }
}
export default verifyToken